<script setup>
import './index.scss'
import { ref, onMounted  } from 'vue'
import { setNavigationBarTitle, useLoad } from "@tarojs/taro"

const tipType = [
  {type: 0, title: '报名成功', imgType: 1, msg: '恭喜您报名成功!' },
  {type: 1, title: '报名失败', imgType: 2, msg: '订单支付失败！' },
  {type: 2, title: '报名成功', imgType: 1, msg: '恭喜您报名成功!',sub: '请您耐心等待商家审核~' },
  {type: 3, title: '报名失败', imgType: 2, msg: '报名失败',sub: '请您重新填写资料或者返回首页~' }
]
const title = 'haha'
const type = ref(0)
useLoad((option) => {
  console.log('option', option)
  type.value = option.type
  setNavigationBarTitle({
    title: tipType[type.value].title
  })
})
// onMounted(() => {
//   console.log('tipType', tipType.value)
//   console.log('type', type)
//     // title设置
//     setNavigationBarTitle({
//       title: tipType[type].title
//     })
// })



</script>
<template>
  <view class="bg page2">
    <cdn-img :src="`/static/img/tip-${tipType[type].imgType===1? 'suc': 'err'}.png`" class="tip-img" />
    <view class="msg">{{tipType[type].msg}}</view>
    <view class="sub" v-if="tipType[type].sub!==null">{{tipType[type].sub}}</view>
    <view class="btns-box">
      <view class="btn">返回首页</view>
      <view class="btn btn1">查看订单</view>
    </view>
  </view>
</template>
